﻿@using ECG.WebUI.CustomHelpers
@model IEnumerable<ECG.WebUI.Models.ProductViewHistoryModel>
@if(Model.Any())
{
    var count = 0;
    <div class="box-p-history">
        <div class="bph-head">
            <div class="bph-text">
                <div class="icon-eye"></div>
                <span>SẢN PHẨM</span>
                <span class="cl-orange">ĐÃ XEM</span>
            </div>
            <div class="bph-continue">
                <a href="javascript:void(0);">
                    <span class="icon-view-continue"></span>
                    XEM THÊM
                </a>
            </div>
        </div>

        <div class="bph-content">
        @foreach(var item in Model.OrderByDescending(m => m.STT))
        {
            count++;
            if (count > 5)
            {
                break;
            }

            <div class="bph-item">
                <div class="bph-item-bg"></div>
                <div class="bph-wrapper-border">
                    <div class="icon-viewed"></div>
                    <div class="bph-wrapper-img"></div>
                    <a title="" href="@item.Url">
                        <img width="188" height="188" alt="" src="@item.ImagePath" class="img-loading" />
                    </a>
                </div>
                <h2>
                    <a title="@item.Name" href="@item.Url">@item.Name</a>
                </h2>
                <div class="bph-item-price">
                    <div class="bph-item-first fl-l">
                        @if(item.PromotionPrice > 0)
                        {
                            <div class="bph-price cl-orange">@item.PromotionPrice.ToString("#,###") <span>VNĐ</span></div>
                            <div class="bph-rootprice">@item.RootPrice.ToString("#,###") VNĐ</div>
                        }
                        else
                        {
                            <div class="bph-price cl-orange">@item.RootPrice.ToString("#,###") <span>VNĐ</span></div>
                        }
                    </div>
                    <div class="clr"></div>
                </div>
            </div>
        }
        </div>
    </div>
}